<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" href="../../css/wxq.css">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../font/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../css/index.css">
</head>
<body>
    <!--头部公共样式-->
    <header class="header">
        <div class = "logo float_left"><a href="index.html">后台管理系统</a></div>
        <div class = "header_right">
            <nav>
                <ul>

                    <li>
                        <a title="更多"><i class = "fa fa-navicon"></i></a>
                        <ul class="dropdown_menu">
                            <li id = "logout">&nbsp;<i class = "fa fa-sign-out"></i>&nbsp;退出</li>
                        </ul>
                    </li>
                    <li>
                        <a href="../message/messages.html" title = "消息"><i class = "fa fa-envelope"></i></a>
                        <span class="message_count"></span>
                    </li>
                </ul>
            </nav>
            <div class = "message_warp_info"></div>
        </div>
    </header>

    <!--主内容区-->
    <div class="container">
        <!--左边导航区-->
        <div class="slide" id ="slide">

            <!--左边管理员信息区域-->
            <div class = "admin_info">
                <a href="#" class = "admin_header_img">
                    <img src="../../images/test_header.png" alt="">
                    <div class = "upload_header_img">更换</div>
                </a>
                <div class = "admin_detail">
                    <span class = "admin_type">超级管理员</span>
                    <span class = "admin_name">王小强</span>
                </div>
            </div>

            <!--左边导航按钮区域-->
            <ul class = "menu" >
                <li>
                    <a href="index.html" class="super_menu active">
                        <i class="fa fa-home"></i>&nbsp;&nbsp;首页
                    </a>
                </li>
                <li>
                    <a class="super_menu">
                        <i class="fa fa-gears"></i>&nbsp;&nbsp;系统配置<i class="fa fa-angle-right"></i>
                    </a>
                    <ul class = "menu_child_list">
                        <li>
                            <a href="../conf/bannerSetting.html">
                                <i class="fa fa-image"></i>&nbsp;&nbsp;banner管理
                            </a>
                        </li>
                    </ul>
                </li>

                <li>
                    <a class="super_menu">
                        <i class="fa fa-users"></i>&nbsp;&nbsp;用户管理<i class="fa fa-angle-right"></i>
                    </a>
                    <ul class = "menu_child_list isSuper">
                        <li>
                            <a href="../user/userList.html">
                                <i class="fa fa-user"></i>&nbsp;&nbsp;用户列表
                            </a>
                        </li>
                        <li>
                            <a href="../member/memberManagement.html">
                                <i class="fa fa-user-plus"></i>&nbsp;&nbsp;会员管理
                            </a>
                        </li>
                        <li>
                            <a href="../member/integralSetting.html">
                                <i class="fa fa-vcard"></i>&nbsp;&nbsp;积分设置
                            </a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a class="super_menu">
                        <i class="fa fa-cart-plus"></i>&nbsp;&nbsp;商城管理<i class="fa fa-angle-right"></i>
                    </a>
                    <ul class = "menu_child_list isSuper">
                        <li>
                            <a href="../category/goodsCategory.html">
                                <i class="fa fa-bar-chart"></i>&nbsp;&nbsp;商品分类
                            </a>
                        </li>
                        <li>
                            <a href="../freight/freightTemplate.html">
                                <i class="fa fa-cart-arrow-down"></i>&nbsp;&nbsp;运费模板
                            </a>
                        </li>
                        <li>
                            <a href="../goods/goodsList.html">
                                <i class="fa fa-list"></i>&nbsp;&nbsp;商品列表
                            </a>
                        </li>
                        <li>
                            <a href="../order/orderList.html">
                                <i class="fa fa-first-order"></i>&nbsp;&nbsp;订单管理
                            </a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="../message/messages.html" class="super_menu">
                        <i class="fa fa-comment"></i>&nbsp;&nbsp;消息管理
                    </a>
                </li>
                <li>
                    <a href="dataStatistics.html" class="super_menu">
                        <i class="fa fa-signal"></i>&nbsp;&nbsp;数据统计
                    </a>
                </li>
                <li>
                    <a href="../admin/authoritySetting.html" class="super_menu">
                        <i class="fa fa-unlock"></i>&nbsp;&nbsp;权限管理
                    </a>
                </li>
            </ul>
        </div>

        <!--内容区-->
        <div class="main_content">

            <!--当前位置-->
            <div class="warp">
                <div class = "position">
                    <span>当前位置：</span>
                    <span>
                         <a href="index.html">首页</a>
                    </span>
                </div>
            </div>

            <div class="warp">
                <div id="data-main" style="width: 100%;height:500px;"></div>
            </div>
            <!--底部版权公共样样式-->
        </div>
    </div>
    <script src = "../../js/jquery-3.2.1.min.js"></script>
    <script src = "../../js/wxq.js"></script>
    <script src="../../my_js/sockjs.min.js"></script>
    <script src="../../my_js/stomp.min.js"></script>
    <script src = "../../my_js/common.js"></script>
    <script src = "../../js/echarts.common.min.js"></script>
    <script>
        $(function () {
            $.get(rootPath+"/charts/recentSales",{days:20},(res)=>{
                if(res.meta.code === 200){
                    let sales_volume = [];
                    let sales_number = [];
                    let time = [];
                    for (let i = res.data.length-1; i>=0;i--){
                        sales_volume.push(parseFloat(res.data[i].sales));
                        sales_number.push(res.data[i].number);
                        time.push(res.data[i].time)
                    }
                    let myChart = echarts.init(document.getElementById('data-main'));
                    let option = {
                        title : {
                            text: '近20天销售额和销售量'
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                crossStyle: {
                                    color: '#999'
                                }
                            }
                        },
                        toolbox: {
                            feature: {
                                dataView: {show: true, readOnly: false},
                                magicType: {show: true, type: ['line', 'bar']},
                                restore: {show: true},
                                saveAsImage: {show: true}
                            }
                        },
                        legend: {
                            data:['销售额','销售量']
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: time,
                                axisPointer: {
                                    type: 'shadow'
                                }
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                name: '销售额',
                                min: 0,
                                axisLabel: {
                                    formatter: '{value} 元'
                                }
                            },
                            {
                                type: 'value',
                                name: '销售量',
                                min: 0,
                                axisLabel: {
                                    formatter: '{value} 单'
                                }
                            }
                        ],
                        series: [
                            {
                                name:'销售额',
                                type:'line',
                                data:sales_volume
                            },
                            {
                                name:'销售量',
                                yAxisIndex: 1,
                                type:'line',
                                data:sales_number
                            }
                        ]
                    };
                    myChart.setOption(option);
                }else {
                    alert(res.meta.message)
                }
            })
        })
    </script>

</body>
</html>